package five.calendar.scheduler;

import java.io.Serializable;

public class Schedule implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 3435314138775888417L;
	/**
	 * @param args
	 */
	private String name;
	private String place;
	private String dateBegin;
	private String timeBegin;
	private String dateEnd;
	private String timeEnd;
	private String with;
	private String memo;
	private boolean finished;
	private boolean important;
	private boolean alarm;

	public Schedule(String name, String place, String dateBegin, String timeBegin, String dateEnd, String timeEnd, String with, String memo, 
			boolean important, boolean alarm) {
		this.name = name;
		this.place = place;
		this.dateBegin = dateBegin;
		this.timeBegin = timeBegin;
		this.dateEnd = dateEnd;
		this.timeEnd = timeEnd;
		this.with = with;
		this.memo = memo;
		this.finished = false;
		this.important = important;
		this.alarm = alarm;
	}
	
	public Schedule(String name, String place, String dateBegin, String timeBegin, String dateEnd, String timeEnd, String with, String memo, boolean important) {
		this(name, place, dateBegin, timeBegin, dateEnd, timeEnd, with, memo, important, false);
	}

	public Schedule(String name, String dateBegin, String timeBegin, String dateEnd, String timeEnd, String memo, boolean important) {
		this(name, null, dateBegin, timeBegin, dateEnd, timeEnd, null, memo, important, false);
	}

	public Schedule(String name, String dateBegin, String timeBegin, String dateEnd, String timeEnd, String memo) {
		this(name, null, dateBegin, timeBegin, dateEnd, timeEnd, null, memo, false, false);
	}

	public Schedule() {
		this(null, null, null, null, null, null, null, null, false, false);
	}

	@Override
	public String toString() {
		return "Schedule\nname=" + name + "\nplace=" + place + "\ndateBegin=" + dateBegin + "\ntimeBegin=" + timeBegin + "\ndateEnd=" + dateEnd
				+ "\ntimeEnd=" + timeEnd + "\nwith=" + with + "\nmemo=" + memo + "\nfinished=" + finished + "\nimportant=" + important + "\nalarm="
				+ alarm;
	}
	
	public String getName() {
		return name;
	}
	
	public String getPlace() {
		return place;
	}
	
	public String getDateBegin() {
		return dateBegin;
	}
	
	public String getTimeBegin() {
		return timeBegin;
	}

	public String getDateEnd() {
		return dateEnd;
	}
	
	public String getTimeEnd() {
		return timeEnd;
	}
	
	public String getWith() {
		return with;
	}
	
	public String getMemo() {
		return memo;
	}

	public void setFinished(boolean finished) {
		this.finished = finished;
	}
	
	public boolean getFinished() {
		return finished;
	}
	
	public boolean getImportant() {
		return important;
	}

	public String getDateYearBegin() {
		StringBuffer tmp = new StringBuffer(dateBegin);

		return tmp.substring(0, 4).toString();
	}

	public String getDateMonthBegin() {
		StringBuffer tmp = new StringBuffer(dateBegin);
		
		return tmp.substring(4, 6).toString();
	}

	public String getDateDayBegin() {
		StringBuffer tmp = new StringBuffer(dateBegin);

		return tmp.substring(6, 8).toString();
	}

	public String getDateYearEnd() {
		StringBuffer tmp = new StringBuffer(dateEnd);

		return tmp.substring(0, 4).toString();
	}

	public String getDateMonthEnd() {
		StringBuffer tmp = new StringBuffer(dateEnd);
		
		return tmp.substring(4, 6).toString();
	}

	public String getDateDayEnd() {
		StringBuffer tmp = new StringBuffer(dateEnd);

		return tmp.substring(6, 8).toString();
	}
}
